package com.gr.dmbackend.service.Impl.sysadmin;

import com.alibaba.fastjson.JSONObject;
import com.gr.dmbackend.mapper.BuildingMapper;
import com.gr.dmbackend.model.Building;
import com.gr.dmbackend.service.sysadmin.GetBuildingListService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class GetBuildingListServiceImpl implements GetBuildingListService {

    @Autowired
    private BuildingMapper buildingMapper;

    @Override
    public JSONObject getBuildingList() {

        JSONObject resp = new JSONObject();

        List<Building> buildings = buildingMapper.selectList(null);
        resp.put("error_message", "success");
        resp.put("buildings", buildings);

        return resp;
    }
}
